1. Field of the Disclosure
The present disclosure relates to a magnetic sensor which can detect the position of a magnet by using the magnet and a magnetic sensor element, and in particular, to a magnetic sensor capable of detecting the position in a magnetization direction of a magnet.
2. Description of the Related Art
A magnetic sensor for detecting the position of a magnet is used in a linear actuator, a non-contact switch, or the like. Japanese Unexamined Patent Application Publication No. 2006-276983 discloses a magnetic sensor for a pointing device. FIGS. 15A to 15E are plan views that describe an outline of a detection method with respect to the magnetic sensor according to an example of the related art described in Japanese Unexamined Patent Application Publication No. 2006-276983. As shown in FIGS. 15A to 15E, a magnetic sensor 110 according to an example of the related art has a circular magnet 120 and four giant magnetoresistance effect elements 131 to 134 and detects the position of the magnet 120 which is moved by an operation force from the outside, by the four giant magnetoresistance effect elements 131 to 134.
FIG. 15A shows the magnetic sensor 110 in the initial state. In the initial state, the center of the magnet 120 is provided to overlap with the center of gravity of the four giant magnetoresistance effect elements 131 to 134. As shown in FIGS. 15B and 15C, if the magnet 120 moves in an X2 direction, the direction of a horizontal magnetic field which is applied from the magnet 120 to the first giant magnetoresistance effect element 131 and the second giant magnetoresistance effect element 132 changes. In this way, the magnetization directions of free magnetic layers of the first giant magnetoresistance effect element 131 and the second giant magnetoresistance effect element 132 change so as to follow a horizontal magnetic field direction from the magnet 120. The magnetization direction of the free magnetic layer of the second giant magnetoresistance effect element 132 changes in the direction in which the angle between the magnetization direction of a fixed magnetic layer and the magnetization direction of the free magnetic layer increases in comparison with the initial state. Further, the magnetization direction of the free magnetic layer of the second giant magnetoresistance effect element 132 changes in the direction in which the angle between the magnetization direction of the free magnetic layer and the magnetization direction of the fixed magnetic layer decreases. As a result, the resistance values of the first giant magnetoresistance effect element 131 and the second giant magnetoresistance effect element 132 change and the position of the magnet 120 is detected from the change in resistance value.
As shown in FIGS. 15D and 15E, when the magnet 120 moves in an X1 direction, the magnetization directions of the free magnetic layers of the first giant magnetoresistance effect element 131 and the second giant magnetoresistance effect element 132 change in the direction opposite to the direction shown in FIGS. 15B and 15C. In this way, the resistance values of the first giant magnetoresistance effect element 131 and the second giant magnetoresistance effect element 132 change, and thus the position of the magnet 120 is detected.
Further, Japanese Unexamined Patent Application Publication No. 2003-149312 discloses a Hall element capable of detecting the strength of the magnetic field from a magnet. In a case where a Hall element is used as a magnetic sensor element, which detects the position of a magnet, the position of the magnet can be detected by detecting the strength of a vertical magnetic field orthogonal to the magneto-sensitive surface of the Hall element.
However, in the magnetic sensor 110 according to an example of the related art shown in FIGS. 15A to 15E, the magnet 120 is installed so as to be able to be displaced in not only the X1-X2 direction, but also a Y direction and a Z direction. For this reason, in a case where the magnet 120 has moved in the Y direction, the magnetic field of a component in the Y direction acts on the first giant magnetoresistance effect element 131 and the second giant magnetoresistance effect element 132 which perform position detection in the X direction, and thus the magnetization direction of the free magnetic layer changes. In this way, a detection error of the position in the X direction of the magnet 120 occurs, and thus accurate position detection by the magnetic sensor 110 becomes difficult.
Further, in a case where the Hall element described in Japanese Unexamined Patent Application Publication No. 2003-149312 is used as a magnetic sensor element, the Hall element detects the magnetic field strength of a vertical component with respect to the magneto-sensitive surface. Since magnetic field strength changes in inverse proportion to the square of the distance between a Hall element and a magnet, even in a case where the position in the X direction of the magnet does not change, when the magnet has moved in the Z direction or the Y direction, the distance between the Hall element and the magnet changes, and thus magnetic field strength which is detected by the Hall element changes. The change in magnetic field strength becomes a detection error component of the magnet position in the X direction, and thus accurate position detection in the X direction of the magnet is difficult.
In Japanese Unexamined Patent Application Publication No. 2012-127799, a magnetic sensor is described in which by providing a soft magnetic body which converts an external magnetic field in a Z-axis direction in X and Y directions, it is possible to detect the external magnetic fields of plural axes by a small number of chips. However, the configuration of a magnetic sensor, which detects the position of a magnet and suppresses a detection error is not described therein.